package com.sz.app.customer.api.base;

import com.sz.biz.app.web.BaseController;
import com.sz.biz.common.base.service.CurrencyService;
import com.sz.common.base.dto.QResultDto;
import com.sz.common.base.dto.ResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Function: CurrencyController <br>
 * Author: xutao <br>
 * Date: 2016-11-30 10:19:00
 */
@RestController
@Api(description = " ", tags = "025、货币管理")
@RequestMapping("/api/v1/biz/currency")
public class CurrencyController extends BaseController {
    @Autowired
    private CurrencyService currencyService;

    /**
     * 获取所有货币的代码及名称
     *
     * @param
     */
    @ApiOperation(value = "获取所有货币的代码及名称", notes = "获取所有货币的代码及名称")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "q", value = "查询的关键字",
                    dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "pageIndex", value = "分页 默认第一页",
                    dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "页面大小",
                    dataType = "int", paramType = "query")})
    @RequestMapping(value = "/list", method = {RequestMethod.GET})
    public ResultDto getCurrencyByCcode(@RequestParam(defaultValue = "") String q,
                                        @RequestParam(defaultValue = "1") int pageIndex,
                                        @RequestParam(name = "pageSize", defaultValue = "1000") int pageSize) {

        QResultDto qResultDto = currencyService.findCurrencies(q, pageIndex, pageSize);

        return qResultDto;

    }

}
